package com.tmzn.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tmzn.domain.TDevicePlan;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TDevicePlanMapper extends BaseMapper<TDevicePlan> {

    /**
     * 统计设备的启用状态，用于更改设备状态
     *
     * @param status   启用状态
     * @param deviceId 设备编号
     * @return 匹配名称但不匹配id的数据的数量
     */
    int countByDeviceIdAndStatus(@Param("deviceId") String deviceId, @Param("status") Long status);

    @Update("update t_device_plan set status = 2 where id in (${ids})")
    int updatePlanById(@Param("ids") String ids);

}
